package LeetCode刷题;

import com.sun.org.apache.xpath.internal.operations.String;

import java.util.LinkedList;
import java.util.Scanner;


/**
 * @program: Java_Study
 * @author: Xiaofan
 * @createTime: 2021-10-19 15:07
 * @description: Functions of this class is
 **/
public class No回文数 {
    public static void main(String[] args) {

    }
    public boolean isPalindrome(int x) {
        if(x>=0&&x<2){
            return true;
        }
        if(x<0){
            return false;
        }
        char nums[]= java.lang.String.valueOf(x).toCharArray();
        int len=nums.length;
        LinkedList<Character> stack=new LinkedList();
        int slow=0;
        int fast=0;
        while(fast<len){
            stack.push(nums[slow]);
            fast+=2;
            slow++;
        }
        if(len%2==1){
            slow--;
        }
        while(slow<len){
            if(stack.isEmpty()||nums[slow]!=stack.pop()){
                return false;
            }
            slow++;
        }

        return true;
    }
}